package com.ggy.controller.manager;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ggy.dao.UserDao;
import com.ggy.dao.impl.UserDaoImpl;
import com.ggy.utils.FastJSONUtils;
import com.ggy.utils.IpUtils;
import com.ggy.utils.Log4jUtil;

/**
 * 主页控制器
 */
@WebServlet("/manage")
public class IndexServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private UserDao userDao=new UserDaoImpl();

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String str=FastJSONUtils.toJsonString(userDao.getUsersbyCondition(1, 10, null));
		Log4jUtil.info(str);
	}

	private void process(HttpServletRequest request, HttpServletResponse response) {

	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		process(request, response);
	}

	@Override
	protected void doPut(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

	}
	
	@Override
	protected void doDelete(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

	}
	/**
	 * 获取方法名
	 * @param request
	 * @return
	 */
	private String getMethodName(HttpServletRequest request) {
		String url = request.getRequestURL().toString();
		String id = null;
		if (url.endsWith("/")) {
			url = url.substring(0, url.length() - 1);
		}
		id = url.substring(url.lastIndexOf("/") + 1);
		return id;
	}
}
